/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package homework.demo03;

/**
 *
 * @author Administrator
 */
public class ID {public static void main(String[] args) {
        String ID = "450703199112237520";
        boolean flag = true;
        if (ID.length() != 18) {
            flag = false;
        }
        if (!(ID.startsWith("45") )) {
            flag = false;
        }
        String numstr = "0123456789abcdefghijklmnopqrstuvwxyz";
        for (int i = 0; i < ID.length(); i++) {
            char c = ID.charAt(i);
            int temp = numstr.indexOf(c);
            if (temp < 0) {
                flag = false;
                break;
            }
        }
        if (flag) {
            System.out.println("是合法的ID");

        } else {
            System.out.println("不是合法的ID");
        }
    }
}


